using System;
using System.Collections.Generic;
using System.Text;

namespace Payroll
{
    public class ChangeUnaffiliatedTransaction : ChangeAffiliationTransaction
    {
        public ChangeUnaffiliatedTransaction(int empid)
            : base(empid)
        {
        }

        public override void RecordMembership(Employee e)
        {
            Affiliation af = e.GetAffiliation();
            if (af is UnionAffiliation)
            {
                UnionAffiliation uaf = (UnionAffiliation)af;
                int memberId = uaf.GetMemberId();
                PayrollDatabase.Default.RemoveUnionMember(memberId);
            }
        }

        public override Affiliation GetAffiliation()
        {
            return new NoAffiliation();
        }
    }
}
